<?php

class Application_Form_Userinfo extends Zend_Form
{

    public function init()
    {
        $this->setName('userinfo');
        $this->setMethod('POST');
        
        $username = new Zend_Form_Element_Text('username');
        $username->setLabel('用户名')
                ->setAttrib('MaxLength', '32')
                ->setAttrib('class','border')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->setAttrib('disabled','disabled');
        
        $email = $this->createElement('text','email',array(
            'Label'=>'Email',
            'class' => 'border',
            'required'=>true,
            'filters' => array('StripTags','StringTrim'),
            'validators' => array('EmailAddress')
        ));
        
        $password = new Zend_Form_Element_Password('password');
        $password->setLabel('原密码')
                ->setAttrib('MaxLength', '32')
                ->setAttrib('class','border')
                ->addFilter('StripTags')
                ->addFilter('StringTrim');
        
        $newpassword = new Zend_Form_Element_Password('newpassword');
        $newpassword->setLabel('新密码')
                ->setAttrib('MaxLength', '32')
                ->setAttrib('class','border')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('StringLength',false,array(6,20));
        
        $renewpassword = new Zend_Form_Element_Password('renewpassword');
        $renewpassword->setLabel('确认密码')
                ->setAttrib('MaxLength', '32')
                ->setAttrib('class','border')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('StringLength',false,array(6,20));
        
        $qq = $this->createElement('text', 'qq', array(
            'Label' => 'QQ',
            'class' => 'border',
            'required' => true,
            'filters' => array('StringTrim'),
            'validators' => array('NotEmpty','Digits')
        ));
        
        $msn = $this->createElement('text', 'msn', array(
            'label' => 'MSN',
            'class' => 'border',
            'required' => false,
            'filters' => array('StringTrim'),
            'validators' => array('NotEmpty')
        ));
        
        $submit=  $this->createElement('submit','update',array(
            'label' => '更新信息',
            'id' => 'updatebtn',
            'class'=>'submit'
            ));
        
        $this->addElements(array($username,$email,$password,$newpassword,$renewpassword,$qq,$msn,$submit));
    }


}

